import {Component, EventEmitter, OnInit, Output, ViewChild, Input} from '@angular/core';
import { appReportUrl } from '../report.url';
import { CudTableService } from 'app/public/serve/cud-table/cud-table.service';
import { Service } from '../../server/server';
import { report } from '../report.data';
import { HintsService } from '../../public/serve/hints/hints.service';
import { RemoveTableService } from '../../public/serve/remove-table/remove-table.service';
import { InitService } from '../../public/serve/init/init.service';
import { ReportInnerTableComponent } from './report-inner-table/report-inner-table.component';

declare var $:any;
@Component({
  selector: 'app-report-inner',
  templateUrl: './report-inner.component.html',
})
export class ReportInnerComponent implements OnInit {

  @ViewChild("table") table : ReportInnerTableComponent;
  @Input() searchData: any;
  right: any = {
    "reportInner": {}
  };

  constructor(
    private server: Service,
    public request: CudTableService,
    private tableListService: CudTableService,
    private hintsService: HintsService,
    private removeTableService: RemoveTableService,
    public initService: InitService,
  ) { 
    this.right = $.extend(this.right, server.getRight());
  }

  ngOnInit() {
   
  }

  /**
   * 搜索
   */
  search(){
    report.retrieval.queryCondition = this.searchData;
    this.table.getIndexingInnerTextList();
  }

  changesearch(){
    this.search();
  }

  /**
   * 分页
   * @param pagination 
   */ 
  _pagination(pagination: Array<any>) {
    report.pagination.pageNo = pagination[0].pageNumber;
    report.pagination.pageSize   = pagination[0].pageSize;
    report.pagination.naturalNum = (report.pagination.pageNo - 1) * report.pagination.pageSize;
    this.table.getIndexingInnerTextList();
  }

}
